Prepare a policy brief for the local City Council representatives. Do households value transit-rich neighborhoods compared to others? How certain can you be about your conclusions given some of the spatial biases we’ve discussed? You must choose a city with open transit station data. (You may do this analysis using data from the 2000 decennial census - as in the book - as the first time period in the analysis OR you may use 2009 ACS 5-year estimates. You may use ACS data of a recent year in place of 2017 if you wish).
Prepare an accessible (non-technical) R markdown document with the following deliverables. Provide a brief motivation at the beginning, annotate each visualization appropriately, and then provide brief policy-relevant conclusions. Please do not suppress code blocks - but you should fold them to make your assignment more legible. Here are the specific deliverables:
Show your data wrangling work.
Four small-multiple (2000 /2009 & 2017+) visualizations comparing four selected Census variables across time and space (TOD vs. non-TOD).
One grouped bar plot making these same comparisons.
One table making these same comparisons.
Create two graduated symbol maps of population and rent within 0.5 mile of each transit station. Google for more information, but a graduate symbol map represents quantities for each transit station proportionally.
Create a geom_line plot that shows mean rent as a function of distance to subway stations (Figure 1.17). To do this you will need to use the multipleRingBuffer function found in the functions.R script.
Show the code
library(tidyverse)library(tidycensus)library(sf)library(ggthemr)library(kableExtra)library(tmap)library(janitor)library(sfdep)library(arcpullr)source("https://raw.githubusercontent.com/urbanSpatial/Public-Policy-Analytics-Landing/master/functions.r")options(tigris_use_cache =TRUE, scipen =999)tmap_mode('view')ggthemr('flat')state <-"CA"county <-"San Francisco"crs <-'EPSG:7132'# NAD 1983 us feet for san franacs_vars <-c("B25026_001E","B02001_002E","B15001_050E","B15001_009E","B19013_001E", "B25058_001E","B06012_002E")palette5 <-c("#f0f9e8","#bae4bc","#7bccc4","#43a2ca","#0868ac")
Show the code
suppressMessages(tracts10 <-get_acs(geography ="tract",variables = acs_vars, year=2010, state=state,county=county, geometry=TRUE,output ="wide") %>%st_transform(crs = crs) %>%rename(TotalPop = B25026_001E, Whites = B02001_002E,FemaleBachelors = B15001_050E, MaleBachelors = B15001_009E,MedHHInc = B19013_001E, MedRent = B25058_001E,TotalPoverty = B06012_002E) %>%mutate(pctWhite =ifelse(TotalPop >0, Whites / TotalPop, 0),pctBachelors =ifelse(TotalPop >0, ((FemaleBachelors + MaleBachelors) / TotalPop), 0),pctPoverty =ifelse(TotalPop >0, TotalPoverty / TotalPop, 0),year ="2010") %>% dplyr::select(-Whites, -FemaleBachelors, -MaleBachelors, -TotalPoverty, -ends_with("M")) %>%filter(!st_is_empty(geometry)) %>%## there's a tract with an empty geom; drop itmutate(nb =as.character(st_contiguity(geometry))) %>%filter(nb !=0) #filter out tracts not on the mainland (i.e., w no contiguous neighbors))suppressMessages(tracts20 <-get_acs(geography ="tract",variables = acs_vars, year=2020, state=state,county=county, geometry=TRUE,output ="wide") %>%st_transform(crs = crs) %>%rename(TotalPop = B25026_001E, Whites = B02001_002E,FemaleBachelors = B15001_050E, MaleBachelors = B15001_009E,MedHHInc = B19013_001E, MedRent = B25058_001E,TotalPoverty = B06012_002E) %>%mutate(pctWhite =ifelse(TotalPop >0, Whites / TotalPop, 0),pctBachelors =ifelse(TotalPop >0, ((FemaleBachelors + MaleBachelors) / TotalPop), 0),pctPoverty =ifelse(TotalPop >0, TotalPoverty / TotalPop, 0),year ="2020") %>% dplyr::select(-Whites, -FemaleBachelors, -MaleBachelors, -TotalPoverty, -ends_with("M")) %>%filter(!st_is_empty(geometry)) %>%## there's a tract with an empty geom; drop itmutate(nb =as.character(st_contiguity(geometry))) %>%filter(nb !=0) #filter out tracts not on the mainland (i.e., w no contiguous neighbors))allTracts <-rbind(tracts10, tracts20)